#ifndef TMMYSQLCTRL_H
#define TMMYSQLCTRL_H

#include <QObject>
#include <QtSql>
#include "RobotDef.h"

class TMMySQLCtrl : public QObject
{
    Q_OBJECT
public:
    enum State{
        OFFLINE,
        ONLINE
    };
    explicit TMMySQLCtrl(QObject *parent = 0);

    bool connect_mysql(QString m_strIp);

    void saveUserState(QString userName, State s);
    void saveRobotInfo(QString robotMac, QString password, QString sn, QString version, State s, QString avAdress);
    void saveCurUserName(QString strMac,QString strName);
    QString queryPwdByName(QString strName);
    NetWorkRobot::CallBackPrx *queryCallBackPrx(QString robotMac);
    QString queryRobotInfo(QString robotMac);
    bool robotIsInMySQL(QString robotMac);
    void queryRobotList(QString userName, Ice::StringSeq &infoList);
    void updateRobotState(QString strMac,State s);


signals:

public slots:
    void slot_timer_mysqlheart();

private:
    QSqlDatabase pr_dbMysql;
};

#endif // TMMYSQLCTRL_H
